﻿/*
 * 文件名称：
 * 程序员：yylu
 * 创建时间：2008/05/20
 * 
 * 功能说明：用户密码修改
 * 
 * 修改人员：
 * 
 * 修改日期：
 * 
 * 修改记录：
 */


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Whir.Common.WebHelper;

public partial class Whir_System_Module_Role_EditPass : System.Web.UI.Page
{    
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();    //登录判断

        if (!IsPostBack)
        {
            setData();                       
        }
    }

    //初始化
    protected void setData()
    {
        Whir.Model.Whir_AdminInfo model = new Whir.SQLServerDAL.Whir_AdminInfo().GetModel(RoleHelper.GetAdminID());
        
        this.litUserName.Text = model.adminName;        
        this.txtAdminTrueName.Text = model.adminTrueName;
        this.hfPwd.Value = model.adminPassword;
    }

    //提交
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Whir.SQLServerDAL.Whir_AdminInfo bll = new Whir.SQLServerDAL.Whir_AdminInfo();
        Whir.Model.Whir_AdminInfo model = new Whir.Model.Whir_AdminInfo();

        model = bll.GetModel(RoleHelper.GetAdminID());

        model.adminName = this.litUserName.Text;
        model.adminTrueName = this.txtAdminTrueName.Text;
        
        //密码               
        model.adminPassword = Whir.Common.WebHelper.StringHelper.GetSHA1Str(this.txtAdminPassword.Text);

        bll.Update(model);

        Whir.Common.WebHelper.JsHelper.redirect(Page, "修改成功！", "EditPass.aspx");
    }
}